{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df_a = pd.read_csv('./data/sourceA/pic_shanghai_mall.txt', sep=' ', header=-1, names=[\n",
    "    'lat',\n",
    "    'lng',\n",
    "    'r',\n",
    "    'f_a0',\n",
    "    'f_a1',\n",
    "    'f_a2',\n",
    "    'f_a3',\n",
    "    'f_a4',\n",
    "    'f_a5',\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df_b = pd.read_csv('./data/sourceB_processed/shanghai_mall_processed.txt', sep='\\t', names= \\\n",
    "['lng','lat','r'] + ['f_b{}'.format(i) for i in range(19)] + ['hotness'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df = pd.concat(\n",
    "    [\n",
    "        df_a[['lat', 'lng', 'r']],\n",
    "        df_a[['f_a{}'.format(i) for i in range(6)]],\n",
    "        df_b[['f_b{}'.format(i) for i in range(19)]],\n",
    "        df_b[['hotness']],\n",
    "    ],\n",
    "    axis=1,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true,
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "df.to_csv('data/sourceAB_shanghai_mall_processedB.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
